<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1">
  <title id="dc20941">DROP RESOURCE GROUP</title>
  <body>
    <p id="sql_command_desc">Removes a resource group.</p>
    <section id="section2">
      <title>Synopsis</title>
      <codeblock id="sql_command_synopsis">DROP RESOURCE GROUP <varname>group_name</varname></codeblock>
    </section>
    <section id="section3">
      <title>Description</title>
      <p>This command removes a resource group from Greenplum Database. Only a superuser can drop a
        resource group. When you drop a resource group, the memory and CPU resources reserved by the
        group are returned to Greenplum Database.</p>
      <p>To drop a role resource group, the group cannot be assigned to any roles, nor can it have
        any statements pending or running in the group. If you drop a resource group that you
        created for an external component, the behavior is determined by the external component. For
        example, dropping a resource group that you assigned to a PL/Container runtime stops running
        containers in the group. </p>
      <p>You cannot drop the pre-defined <codeph>admin_group</codeph> and
          <codeph>default_group</codeph> resource groups.</p>
    </section>
    <section id="section4">
      <title>Parameters</title>
      <parml>
        <plentry>
          <pt><varname>group_name</varname></pt>
          <pd>The name of the resource group to remove.</pd>
        </plentry>
      </parml>
    </section>
    <section id="section5">
      <title>Notes</title>
      <p>You cannot submit a <codeph>DROP RESOURCE GROUP</codeph> command in an explicit transaction
        or sub-transaction.</p>
      <p>Use <codeph><xref href="ALTER_ROLE.xml#topic1" type="topic" format="dita"/></codeph> to
        remove a resource group assigned to a specific user/role.</p>
      <p> Perform the following query to view all of the currently active queries for all resource
        groups:</p>
      <codeblock>SELECT usename, query, waiting, pid,
    rsgid, rsgname, rsgqueueduration 
  FROM pg_stat_activity;
</codeblock>
      <p>To view the resource group assignments, perform the following query on the
          <codeph>pg_roles</codeph> and <codeph>pg_resgroup</codeph> system catalog tables:</p>
      <codeblock>SELECT rolname, rsgname 
  FROM pg_roles, pg_resgroup
  WHERE pg_roles.rolresgroup=pg_resgroup.oid;</codeblock>
    </section>
    <section id="section6">
      <title>Examples</title>
      <p>Remove the resource group assigned to a role. This operation then assigns the default
        resource group <codeph>default_group</codeph> to the role:</p>
      <codeblock>ALTER ROLE bob RESOURCE GROUP NONE;</codeblock>
      <p>Remove the resource group named <codeph>adhoc</codeph>:</p>
      <codeblock>DROP RESOURCE GROUP adhoc;</codeblock>
    </section>
    <section id="section7">
      <title>Compatibility</title>
      <p>The <codeph>DROP RESOURCE GROUP</codeph> statement is a Greenplum Database extension. </p>
    </section>
    <section id="section8">
      <title>See Also</title>
      <p><codeph><xref href="ALTER_RESOURCE_GROUP.xml#topic1" type="topic" format="dita"/></codeph>,
            <codeph><xref href="CREATE_RESOURCE_GROUP.xml#topic1" type="topic" format="dita"
          /></codeph>, <codeph><xref href="ALTER_ROLE.xml#topic1" type="topic" format="dita"
          /></codeph></p>
    </section>
  </body>
</topic>
